package com.ym521.demo

import android.app.Application
import android.util.Log
import com.ym521.ymandroidcrash.ExceptionHandler
import com.ym521.ymandroidcrash.YmAndroidCrach

class MyApplication : Application() {

    override fun onCreate() {
        super.onCreate()
        YmAndroidCrach.install(this, object : ExceptionHandler() {
            override fun onUncaughtExceptionHappened(thread: Thread?, throwable: Throwable?) {
                Log.e("YmAndroidCrach", "onUncaughtExceptionHappened:${throwable.toString()}")
            }

            override fun onBandageExceptionHappened(throwable: Throwable?) {
                Log.e("YmAndroidCrach", "onBandageExceptionHappened:${throwable.toString()}")
            }

            override fun onEnterSafeMode() {
                Log.e("YmAndroidCrach", "onEnterSafeMode:启动安全模式")
            }

            override fun onMayBeBlackScreen(e: Throwable?) {
                Log.e("YmAndroidCrach", "onMayBeBlackScreen:黑屏")
            }

        })
    }
}